package com.example.demo2.entity;

import lombok.Data;
import javax.persistence.Id;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;
import cn.hutool.core.util.IdUtil;
import org.joda.time.DateTime;

/**
 * @Author 胡亚伟
 * @Date 2025-06-10
 * @version 1.0
 * @注释
 */

@Data
public class AccountExtend {
	@Id
	private String id;

	/** 签到点 */
	private int sign;
	/** 点券 */
	private Integer coupon;
	/** 猜拳积分 */
	private Integer consume;
	/** 成长值 */
	private Integer experience;

	private String account;

	private String qq;

	/** 设置是否可绑定 qq 默认1 绑定之后 0，如果需要换绑 将此字段设置 1 */
	private int canbindqq;

	/** 设置是否可绑定 账号 默认1 绑定之后 0，如果需要换绑 将此字段设置 1 */
	private int canbindaccount;

	@LastModifiedDate
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date updateTime;

	@Temporal(TemporalType.TIMESTAMP)
	@LastModifiedDate
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date signTime;

	private String mysteriousShop;

	private Integer guessingNum;

	private String lastGuessingDay;

	private Integer guessingTotalNum;

	@PrePersist
	protected void prePersist() {
		id = IdUtil.fastUUID();
		this.updateTime = DateTime.now().toDate();
	}

	@PreUpdate
	protected void preUpdate() {
		this.updateTime = DateTime.now().toDate();
	}

}
